package feeinterface.utils;

import java.util.Map;

import com.ulwx.tool.ArrayUtils;
import com.ulwx.tool.StringUtils;
import com.ulwx.type.TInteger;

public class DaoUtil {

	public static String 
		getSqlWherePartAndSetParms(String property, Object[] objs,Map<Integer,Object> vars,TInteger startIndex) {
		
		if(ArrayUtils.isEmpty(objs)){
			return " (1=1) ";
		}
		
		int f=startIndex.getValue();
		String sqlpart = 
				"  " +
				property +"  "+ "("
				+ StringUtils.arrayToCommaDelimitedString(ArrayUtils.nCopy("?",
						objs.length)) + ")";
		for (int i = 0; i < objs.length; i++) {
			vars.put(f++, objs[i]);
		}
		startIndex.setValue(f);
		return sqlpart;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
